= What? =

Hypirinha is a Java library for generating HTML.  Hypirinha follows the fluent interface style, whereby several method calls can be chained together as single statement to achieve the desired result.

Hypirinha is statically typed; it defines classes for every element type and every attribute type that exist in HTML.  Methods for creating and combining elements are constrained by these classes so that it is hard to generate HTML that has an invalid structure.  Also, any document fragment is a Java object with a well-known type and so can be stored as a variable or passed as a parameter.  This means that it is easy use standard Java constructs for iteration and method invocation while generating HTML.


= Conventions =

Calling a method on an element creates a child element, and returns that new child element
Parameters passed to any method call are attributes for the element being created.
There are two factories provided (ElementFactory and AttributeFactory) which define convenience methods creating elements and attributes respectively.  It is recommended to statically import all the methods from these classes.


= Adapters =

PrintAdapter - 
DOMAdapter - 


= Packaging =

Hypirinha is packaged as a single jar, with no downstream dependencies beyond what get with a standard JRE.  To use it in an application, just add the jar to the application's classpath.
Hypirniha requires a Java 5 or later JRE.


= Limitations =

 * write-only: there's no query mechanism built into the object model, so if you want to know what it contains you first have to convert the object model to an external form such as DOM or text.
 * no parser: no mechanism is provided to transform an external document (such as a text file) into the hypirinha object model.  For example, you can't use hypriniha to combine fragments of HTML that are stored as text files or were generated by another mechanism.
 * no HTML editors: hypirinha code is Java code and looks nothing like HTML, so clearly any HTML editor that might cope with templating languages is not going to work with hypirinha.
 * not production-tested: hypirinha is experimental.  However, hopefully it's simple enough that any major flaws should be easy to find.


= The Future =

The next stage of the experiment is to incorporate hypirinha into a web framework that makes use of its static typing to do some automatic wire-up of page components.  There is a framework which does this in early stages of development.